<%@page import="com.eos.orm.mybatis.model.ProductModel"%>
<%@page import="com.eos.orm.mybatis.model.ProductBrand"%>
<%@page import="com.eos.orm.mybatis.model.SysProduct"%>
<%@page import="com.eos.orm.mybatis.model.ActivtyMappModel"%>
<%@page import="com.eos.common.tool.ConstantTool"%>
<%@page import="com.eos.common.tool.DataCacheUtil"%>
<%@page import="com.eos.orm.mybatis.model.SysActivty"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<% 
List<ActivtyMappModel> amList = (List<ActivtyMappModel>)request.getAttribute("activtyModelList");

List<SysProduct> proList = (List<SysProduct>)request.getAttribute("productList");
List<ProductBrand> brandList = (List<ProductBrand>)request.getAttribute("brandList");
List<ProductModel> modelList = (List<ProductModel>)request.getAttribute("modelList");
%>
<style>
.page .searchBar label{width: 80px;}
</style>
<!-- 此处加action="employeeCtrl.ctrl"是为了条件查询时仍能显示排序图标 -->
<form id="pagerForm" method="post" action="showActivityModel">
	<input type="hidden" name="pageNum" value="${pageNum}" />
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
</form>
<div class="pageHeader">
	<form onsubmit="return dialogSearch(this);" rel="pagerForm" method="post" action="showActivityModel">
		<div class="searchBar">
			<input type="hidden" name="numPerPage" value="${numPerPage}" />
			<input type="hidden" name="pageNum" value="${pageNum}" /> 
			<table class="searchContent">
				<tr>
					<td>
						<label>子活动ID:</label>
						<input type="text" name="activtySonId"  size="12" style="float:left;" value="${activtySonId }" />
						<a rel="showSonActivity" class="btnLook" maxable="false" href="showSonActivity" lookupgroup="">查找带回</a>
					</td> 
					<td>
						<label>活动状态: </label>
						<select name="dealFlag" class="combox">
							<option value="" ${dealFlag == "" ? "selected='selected'" : "" }>全部</option>
							<option value="0" ${dealFlag == "0" ? "selected='selected'" : "" }>正常</option>
							<option value="1" ${dealFlag == "1" ? "selected='selected'" : "" }>删除</option>
						</select>
					</td>
					<td>
						<div class="subBar">
							<ul>
								<li>
									<div class="buttonActive">
										<div class="buttonContent">
											<button type="submit">
												检索
											</button>
										</div>
									</div>
								</li>
							</ul>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			
		</ul>
	</div>
	<table class="table" width="100%" layoutH="115">
		<thead>
			<tr>
				<th width="80">序号</th>
				<th>活动型号ID</th>
				<th>活动ID</th>
				<th>子活动ID</th>
				<th>品名</th>
				<th>品牌</th>
				<th>型号</th>
				<th>采购价</th>
				<th>补贴一</th>
				<th>补贴二</th>
				<th>补贴三</th>
				<th>补贴四</th>
				<th>补贴五</th>
				<th>补贴六</th>
				<th>套餐配置</th>
				<th>创建时间</th>
				<th>备注</th>
				<th>状态</th>
				<th>查找带回</th>
			</tr>
		</thead>
		<tbody>
		    <%if(null != amList){ 
		    	int i = 1;
		        for(ActivtyMappModel am : amList){
		   %>
		   			<tr target="sid_activtyModelId" rel="<%=am.getId() %>">
					<td><%=i++ %></td>
					<td><%=am.getId() %></td>
					<td><%=am.getActivtyId() %></td>
					<td>
						<%=am.getActivtyId() %>
					</td>
					<td>
						 <% 
						 	if(null != proList){
							  for(SysProduct pro : proList){
							  	if(pro.getId()==am.getProductId().intValue()){
							  		out.print(pro.getProductName());
							  		break;
							  	}
							  }						 	
						 	}
						 %>
					</td>
					<td>
					<% 
					if(null != brandList){
						for(ProductBrand br : brandList){
						   if(br.getId()==am.getBrandId().intValue()){
						   	out.print(br.getBrandName());
						   	break;
						   }
						}
					}
					%>
					</td>
					<td>
					<%
					  if(null != modelList){
					  	for(ProductModel pm : modelList){
						  if(pm.getId()==am.getModelId().intValue()){
						    out.print(pm.getModelName());
						    break;
						  }					  	
					  	}
					  }
					%>
					</td>
					<td>￥<%=am.getPurchasePrice() %></td>
					<td>
						 ￥<%=am.getFirstSubsidy() %>
					</td>
					<td>￥<%=am.getSecondSubsidy() %></td>
					<td>￥<%=am.getThirdSubsidy() %></td>
					<td>￥<%=am.getFourthSubsidy() %></td>
					<td>￥<%=am.getFifthSubsidy() %></td>
					<td>￥<%=am.getSixthSubsidy() %></td>
					<td>
					<% 
						if(am.getComboConfig().equals("0")){
					%>
					<a style="color:#f00; text-decoration: none;">未配置</a>
					<%}else{ %>
					<a style="color:#006400; text-decoration: none;">已配置</a>
					<%} %>
					</td>
					<td><%=am.getInsertTime() %></td>
					<td><%=am.getMappDesc() %></td>
					<td>
					<% 
						if(am.getDealFlag().equals("1")){
					%>
					<a style="color:#f00; text-decoration: none;">删除</a>
					<%}else{ %>
					<a style="color:#006400; text-decoration: none;">正常</a>
					<%} %>
					</td>
					<td>
						<a class="btnSelect" href="javascript:$.bringBack({mappId:'<%=am.getId() %>'})" title="查找带回">选择</a>
					</td>
				</tr>
		   <%}
		   }
		  %>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<!-- pageNum:1是当更改numPerPage时，使pageNum=1重新开始，否则可能无数据 -->
			<select class="combox" name="numPerPage"
				onchange="navTabPageBreak({numPerPage:this.value, pageNum:1})">
				<option value="15" ${numPerPage==15?'selected':''}>
					15
				</option>
				<option value="20" ${numPerPage==20?'selected':''}>
					20
				</option>
				<option value="25" ${numPerPage==25?'selected':''}>
					25
				</option>
				<option value="50" ${numPerPage==50?'selected':''}>
					50
				</option>
				<option value="100" ${numPerPage==100?'selected':''}>
					100
				</option>
			</select>
			<span>条，共${totalCount }条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${totalCount }" numPerPage="${numPerPage}" pageNumShown="5" currentPage="${pageNum }"></div>
	</div>
</div>
